/*******************************************************************************
* @file    fins_struct.h
* @author  Fins
* @brief   
* @time    2020-11-13 20:07:05 Friday
* @codeing UTF-8
* @license
*     Copyright 2020 Fins
*
*     Licensed under the Apache License, Version 2.0 (the "License");
*     you may not use this file except in compliance with the License.
*     You may obtain a copy of the License at
*
*         http://www.apache.org/licenses/LICENSE-2.0
*
*     Unless required by applicable law or agreed to in writing, software
*     distributed under the License is distributed on an "AS IS" BASIS,
*     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*     See the License for the specific language governing permissions and
*     limitations under the License.
* @verbatim
================================================================================
                        ##### xxxxxxxxxxxxxxxxxxxxxxx #####
================================================================================
* @endverbatim
* @attention
*******************************************************************************/



/** Prevent recursive inclusion */
#ifndef __HFILE_H
#define __HFILE_H

/** C++ compatible */
#ifdef __cplusplus
 extern "C" {
#endif /** __cplusplus */

/* Includes start *************************************************************/
/*     Lib files ****************************** */

/*     User files ***************************** */


/* Includes end ***************************************************************/

/* Exported define start ******************************************************/

/**
  * @brief Get struct member offset
  * @param[in] typeName:  Struct name
  * @param[in] memberName: Struct member name
  * @retval Offset
  */
#define FS_GET_MEMBER_OFFSET(typeName,memberName)                              \
    ((faddr)&(((typeName*)0)->memberName))

/**
  * @brief Get struct base address
  * @param[in] memberAddr: Struct member address or point
  * @param[in] typeName: Struct name
  * @param[in] memberName: Struct member name
  * @retval Struct base address
  */
#define FS_GET_BASE_ADDR(memberAddr,typeName,memberName)                       \
    ((faddr)memberAddr-FS_GET_MEMBER_OFFSET(typeName,memberName))

/**
  * @brief Get struct entry point
  * @param[in] memberAddr: Struct member address or point
  * @param[in] typeName: Struct name
  * @param[in] memberName: Struct member name
  * @retval Struct entry point
  */
#define FS_GET_ENTRY_POINTER(memberAddr,typeName,memberName)                     \
    ((typeName*)FS_GET_BASE_ADDR(memberAddr,typeName,memberName))

/* Exported define end ********************************************************/

/* Exported typedef start *****************************************************/





/* Exported typedef end *******************************************************/

/* Exported variable start ****************************************************/





/* Exported variable end ******************************************************/

/* Exported function start ****************************************************/





/* Exported function end ******************************************************/

/** C++ compatible */
#ifdef __cplusplus
}
#endif /** __cplusplus */

#endif /** __HFILE_H */
////////////////////////////////- END OF FILE  -////////////////////////////////
